//
//  SetViewController.m
//  Yearly Plan
//
//  Created by admin on 2019/2/27.
//  Copyright © 2019年 admin. All rights reserved.
//

#import "SetViewController.h"
#import "FeedBackController.h"
#import "AboutUsController.h"
@interface SetViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UIView *topView;
@property (weak, nonatomic) IBOutlet UITableView *tableview;
@property (weak, nonatomic) IBOutlet UIImageView *headimage;

@end

@implementation SetViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"set";
    self.headimage.layer.cornerRadius = 57;
    self.headimage.layer.masksToBounds = YES;
    self.view.backgroundColor = HEX_COLOR(0xF1F1F1);
    self.topView.backgroundColor = HEX_COLOR(0xF7CE47);
    self.tableview.backgroundColor = HEX_COLOR(0xF1F1F1);
    self.tableview.delegate = self;//
    self.tableview.dataSource = self;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 60;
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 3;
}

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return 10;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 1;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cells"];
    if (!cell) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cells"];
    }
    switch (indexPath.section) {
        case 0:
            if (indexPath.row==0) {
                cell.textLabel.text = @"About us";
                cell.imageView.image = [UIImage imageNamed:@"icon_ren"];
                cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
            }
            break;
        case 1:
            if (indexPath.row==0) {
                cell.textLabel.text = @"Current version";
                cell.imageView.image = [UIImage imageNamed:@"icon_banben"];
                cell.detailTextLabel.text = @"1.0";
                cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
            }
            break;
        case 2:
            if (indexPath.row==0) {
                cell.textLabel.text = @"Feedback";
                cell.imageView.image = [UIImage imageNamed:@"icon_fankui"];
                cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
            }
            break;
        default:
            break;
    }
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [self.tableview deselectRowAtIndexPath:indexPath animated:YES];
    if (indexPath.section==0) {
        if (indexPath.row==0) {
            AboutUsController *vc = [AboutUsController new];
            [self.navigationController pushViewController:vc animated:YES];
        }
    }
    if (indexPath.section==1) {
        if (indexPath.row==0) {
            [self showHint:@"App Version 1.0"];
        }
    }
    if (indexPath.section==2) {
        if (indexPath.row==0) {
            FeedBackController *vc = [FeedBackController new];
            [self.navigationController pushViewController:vc animated:YES];
        }
    }
}



@end
